<%@ page language="java" pageEncoding="utf-8" contentType="text/html; charset=utf-8"%>
<%@ taglib prefix="ww" uri="webwork" %>
<ww:bean name="'com.css.apps.base.dict.service.DictMan'" id="dictID" />
<style>
input[type="text"]{
  border:0;
  border-bottom: 1px solid #dfdfdf;
  -webkit-box-shadow:none;
  box-shadow:none;
}
</style>
<div class="page-header">
	<ww:if test="uuid!=null">
		<h5>修改组织机构树</h5>
	</ww:if>
	<ww:else>
		<h5>添加组织机构树</h5>
	</ww:else>
</div>
<form id="custom_form" name="custom_form" action="<ww:if test="uuid!=null">updCustomOrgTree.action</ww:if><ww:else>addCustomOrgTree.action</ww:else>" onSubmit="return $action.submit(this,null,null,closeTabRefreshTabForm);" >
	<input type="hidden" id="parentId" name="parentId" value="<ww:property value='parentId'/>">
	<input type="hidden" id="uuid" name="uuid" value="<ww:property value='uuid'/>"/>
	<input type="hidden" id="exp" name="exp" value="<ww:property value='exp'/>"/>
    <div layoutH="84">
	<div style="float:left;padding:10px;">
		<div class="control-group">
			<ul>
				<li>
					系 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;统：<select class="input-medium" name="sysId" id="sysId" onChange='param_Change();'>
						<ww:iterator value="sysList">
							<option value="<ww:property value='uuid'/>" <ww:if test="uuid ==exp_sysid">selected</ww:if> >
								<ww:property value="name"/>
							</option>
						</ww:iterator>
					</select>
				</li>
				<li style="margin-top:10px;">
					展示级数：
					<select name="series" id="series"  class="input-small" onChange="param_Change();">
		        		<ww:iterator value="#dictID.getDictListQuery('d_series')">
		        			<option value="<ww:property value="code"/>" <ww:if test="code == exp_series">selected</ww:if> >
		        				<ww:property value="name"/>
		        			</option>
		        		</ww:iterator>
				  </select>
				</li>
			</ul>
		</div>
		
		<div class="control-group">
			<table>
				<tr>
					<td >表&nbsp; 达&nbsp;式：</td>
					<td id="exp_id" style="border-bottom: 1px solid #dfdfdf;"></td>
					<td style="border-bottom: 1px solid #dfdfdf;">
						<input type="text" id="exp_series" name="exp_series" class="input-medium" value="" style="border:0;box-shadow:none;margin-bottom:0;">
					</td>
				</tr>
				<tr>
					<td>描 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;述：</td>
					<td colspan="3" style="padding-top: 15px;">
						<textarea id="des" name="des" rows="5" cols="10" style="width:299px;"><ww:property value="des"/></textarea>
					</td>
				</tr>
			</table>
		</div>
	
	</div>
	<div data-spy="affix" data-offset-top="200" id="content" style="overflow-y: auto;width:50%;float:right" >
	</div>
	</div>
	<div class="set-btn" data-spy="affix" data-offset-top="200">
		<button class="btn green" type="button" onclick="addCustom();">保存</button>
		<a id="getPreview" class='btn green' onclick="getPreview();">预览</a>&nbsp;
		<a class="btn" href="javascript:;" onclick="closeTab()">取消</a> 
	</div>
</form> 
<script>
  param_Change();
  getPreview();
  function param_Change(){
	var $sysId=$('#sysId').find("option:selected").val();
	var $series=$('#series').val();
	if($series==""){
		$('#exp_id').html("sysId："+$sysId);
		$('#exp_series').attr("value",$series);
	}else{
		$('#exp_id').html("sysId："+$sysId+"，");
		$('#exp_series').attr("value","series："+$series);
	}
  }
  function getPreview(){
	  debugger;
	  var $a=$("#uuid",$navTab.focus()).val();
	  var $b=$("#parentId",$navTab.focus()).val();
		$.ajax({
			type : "POST", // 用POST方式传输
			url : "getPreviewTree.action",
			data : {"parentId":$("#parentId",$navTab.focus()).val(),"series":$('#series',$navTab.focus()).val()},
			beforeSend : function() {}, 
			complete : function() {}, 
			error : function(XMLHttpRequest, textStatus, errorThrown) {},
			success : function(data) {
				$("#content",$navTab.focus()).html(data);
			},
			cache : false
		});
  }
  function addCustom(){
	  $exp_id=$('#exp_id',$navTab.focus()).html();
	  $exp_series=$('#exp_series',$navTab.focus()).val();
	  var $exp=$exp_id+$exp_series;
	  var $parentId=$("#parentId",$navTab.focus()).val();
	  $('#exp',$navTab.focus()).attr("value",$exp_id+$exp_series+"，parentOrgId："+$parentId);
	  var $data=$("#content",$navTab.focus()).html();
	  $('#custom_form',$navTab.focus()).submit();
  }
   function closeTabRefreshTabForm(tabId){
		closeTab(tabId);
		$navTab.refreshCurrentTabForm();
	}
</script>